package com.apps.diet.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Service;

import com.apps.diet.dao.IMealsDao;
import com.apps.diet.domain.Meals;

@Service("mealsService")
//@Transactional
public class MealsService implements IMealsService {

	protected static Logger logger = Logger.getLogger(MealsService.class);
	
	IMealsDao mealsDao;
	
	@Autowired
	@Required
	public void setDietDao(IMealsDao mealDao) {
		this.mealsDao = mealDao;
	}

	@Override
	public List<Meals> getMeals(String searchString) {
		List<Meals> mealsResults = mealsDao.getMeals(searchString);
		return mealsResults;
	}

	@Override
	public boolean updateMeals(Meals meals) {
		return mealsDao.updateMeals(meals);
	}

	@Override
	public boolean createMeals(Meals meals) {
		return mealsDao.createMeals(meals);
	}

	@Override
	public boolean deleteMeals(int mealsId) throws Exception {
		return mealsDao.deleteMeals(mealsId);
	}
}
